package org.example.traing.service.Impl;


import org.example.traing.entity.ChatMessage;
import org.example.traing.persistence.ChatMessageMapper;
import org.example.traing.service.ChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service(value = "ChatService")
public class ChatServiceImpl implements ChatService {






    @Autowired
    ChatMessageMapper chatMessageMapper;


    // 保存聊天消息
    public void saveMessage(ChatMessage message) {
        System.out.println("111111111111111111111111");
        chatMessageMapper.insertMessage(message);
    }

    // 获取聊天消息
    public List<ChatMessage> getMessages(String roomId) {
        return chatMessageMapper.findMessagesByRoomId(roomId);
    }
}